﻿/*
Copyright (c) 2010 Vratislav Cermak (vratacermak@gmail.com)
 
This file is part of TeachMe Project. See http://code.google.com/p/teach-me for more information.
 
TeachMe is an open source project. Using of TeachMe is free of charge.
It is distributed under GNU General Public License version 3 (GPLv3).
GPLv3 can be found at http://www.gnu.org/licenses/gpl.html.
 
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.  See the license for more details.
*/

using TeachMe.Application.Properties;

namespace TeachMe.Application.Import
{
    public partial class Introduction : WizardPage
    {
        public enum SourceFormat
        {
            Unknown,
            DictsInfoBasicVocabulary,
            SubtitlesSrt
        }

        public class Source
        {
            public SourceFormat Format { get; set; }
            public string Caption { get; set; }
        }

        public SourceFormat Format
        {
            get
            {
                return cbFormat.SelectedItem != null ? ((ComboBoxItem<SourceFormat>) cbFormat.SelectedItem).Item : SourceFormat.Unknown;
            }
            set
            {
                ComboBoxItem<SourceFormat>.Select(cbFormat, value);
            }
        }

        public Introduction()
        {
            InitializeComponent();

            cbFormat.Items.Add(new ComboBoxItem<SourceFormat>(SourceFormat.DictsInfoBasicVocabulary, Resources.ImportFormatDictsInfoBasicVocabulary));
            cbFormat.Items.Add(new ComboBoxItem<SourceFormat>(SourceFormat.SubtitlesSrt, Resources.ImportFormatSubtitlesSrt));
        }

        void OnSelectedIndexChanged(object sender, System.EventArgs e)
        {
            InvokeChanged();
        }

        public override bool Valid
        {
            get
            {
                return Format != SourceFormat.Unknown;
            }
        }
    }
}
